function result = avarage(m,v)

sigma_square_bar = sigmasquarebar(m,v);

f = @(y) 1/v^2 *quadgk(@(y) ((2+sin(y)).^2-sigma_square_bar).*normpdf(y,m,v), -Inf ,y);

% space=linspace(-10,10,10000);
% fy=zeros(1,1000);
% 
% for ii=1:10000;
%     fy(ii)=f(space(ii));
% end
% hold on
% plot(space,fy,'k')

g = @(y) f(y)*(2+sin(y));
N=100000; a=0; b=2;
space=linspace(a,b,N);

result=0;

for ii=1:N
    result=result+g(space(ii));
    disp(ii)
end

result=(result-g(-4)/2-g(6)/2)*((b-a)/N);
    